package com.zhuoyue.common.core.controller;

import java.io.Serializable;

/**
 * ClassName: ControllerResult <br/>
 * Description: action层向页面返回的信息(通用方法)<br/>
 * date: 2019/1/28 9:32<br/>
 *
 * @author wjming<br />
 * @version 1.0
 */
public class ControllerResult implements Serializable {

    //操作结果标志
    private boolean success;

    //返回信息msg;
    private String msg;

    //service层返回对象

    private Object data;

    //消息code
    private String code;

    private String access_token;
    private String count;

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }


    public ControllerResult() {
        super();
    }

    public ControllerResult toSuccess(Object data) {
        this.success = true;
        this.data = data;
        return this;
    }

    public ControllerResult toFail(String msg) {
        this.success = false;
        this.msg = msg;
        return this;
    }


    public ControllerResult toFail(String code, String msg) {
        this.success = false;
        this.code = code;
        this.msg = msg;
        return this;
    }

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }
}
